﻿/*
* 创建者：LIYINFAI
* 创建时间：2023/7/28 11:12:43
* 描述：
* --------------------------------------
* 修改说明：
* --------------------------------------
*/
using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace CommonLibrary
{
    /// <summary>
    /// LED时间
    /// </summary>
    /// <seealso cref="System.Windows.Forms.UserControl" />
    public partial class UCLEDTime : UserControl
    {
        private DateTime m_value;
        /// <summary>
        /// 值
        /// </summary>
        /// <value>The value.</value>
        [Description("值"), Category("自定义")]
        public DateTime Value
        {
            get { return m_value; }
            set
            {
                m_value = value;
                string str = value.ToString("HH:mm:ss");
                for (int i = 0; i < str.Length; i++)
                {
                    ((UCLEDNum)this.tableLayoutPanel1.Controls.Find("D" + (i + 1), false)[0]).Value = str[i];
                }
            }
        }
        private int m_lineWidth = 8;
        /// <summary>
        /// 线宽度
        /// </summary>
        /// <value>The width of the line.</value>
        [Description("线宽度，为了更好的显示效果，请使用偶数"), Category("自定义")]
        public int LineWidth
        {
            get { return m_lineWidth; }
            set
            {
                m_lineWidth = value;
                foreach (UCLEDNum c in this.tableLayoutPanel1.Controls)
                {
                    c.LineWidth = value;
                }
            }
        }
        /// <summary>
        /// 获取或设置控件的前景色。
        /// </summary>
        /// <value>The color of the fore.</value>
        /// <PermissionSet>
        ///   <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
        /// </PermissionSet>
        [Description("颜色"), Category("自定义")]
        public override System.Drawing.Color ForeColor
        {
            get
            {
                return base.ForeColor;
            }
            set
            {
                base.ForeColor = value;
                foreach (UCLEDNum c in this.tableLayoutPanel1.Controls)
                {
                    c.ForeColor = value;
                }
            }
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        public UCLEDTime()
        {
            InitializeComponent();
            Value = DateTime.Now;
        }
    }
}
